package hongcaosp.app.android.user.settings.wallet.holder;

import android.view.View;
import android.widget.TextView;

import hongcaosp.app.android.R;
import hongcaosp.app.android.common.BaseHolder;
import hongcaosp.app.android.modle.bean.Income;
import xlj.lib.android.base.utils.DateUtil;
import xlj.lib.android.base.view.OnRecycleItemClickListener;

/**
 * 钱包记录-收入
 */
public class IncomeHolder extends BaseHolder<Income> {

    private TextView tv_title,tv_date,tv_money;

    public IncomeHolder(View itemView, OnRecycleItemClickListener recycleItemClickListener) {
        super(itemView, recycleItemClickListener);
        tv_title = itemView.findViewById(R.id.tv_title);
        tv_date = itemView.findViewById(R.id.tv_date);
        tv_money = itemView.findViewById(R.id.tv_money);
    }

    @Override
    public void setData(Income income) {
        super.setData(income);
        if (income.getType() != null) {
            String title = "";
            if (income.getType() == 3) {
                title = "红包";
            } else if (income.getType() == 4) {
                title = "邀请奖励";
            } else if (income.getType() == 1) {
                title = "充值";
            } else if (income.getType() == 2) {
                title = "提现";
            }
            tv_title.setText(title);
        }
        String temp = "+";
        if ("ex".equals(income.getExIn())) {
            temp = "-";
        }
        tv_money.setText(temp +  + income.getAmount());
        tv_date.setText(DateUtil.stampToDate(income.getCreateTime(),"yyyy.MM.dd"));
    }
}
